package org.spring.springboot.service.impl;

import java.io.Serializable;
import java.util.List;

import org.spring.springboot.dao.BaseDao;
import org.spring.springboot.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
public class BaseServiceImpl<T, ID extends Serializable> implements BaseService<T, ID> {

	protected BaseDao<T, ID> BaseMapper;

	public BaseDao<T, ID> getBaseMapper() {
		return BaseMapper;
	}

	@Autowired
	public void setBaseMapper(BaseDao<T, ID> baseMapper) {
		BaseMapper = baseMapper;
	}

	@Override
	public List<T> findAll() {
		return getBaseMapper().findAll();
	}

	@Override
	public T find(ID id) {
		return getBaseMapper().find(id);
	}

	@Override
	public void delete(ID id) {
		getBaseMapper().delete(id);
	}

	@Override
	public void add(T t) {
		getBaseMapper().add(t);
	}

	@Override
	public void update(T t) {
		getBaseMapper().update(t);

	}

}
